package com.gxar.quick.ar.server.base.common.enums.protocol;


import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

/**
 * AR内容子类型枚举
 *
 * @author zxh
 * @version 1.0
 * @created 2024/01/02.
 */
@Getter
public enum ArContentSubTypeEnum {

    DEFAULT("", "默认"),
    STATIC("static", "静态"),
    VIDEO("video", "视频"),
    SPRITE("sprite", "雪碧图/精灵图"),

    ;

    private final String name;
    private final String desc;

    ArContentSubTypeEnum(String name, String desc) {
        this.name = name;
        this.desc = desc;
    }

    @JsonCreator
    public static ArContentSubTypeEnum getByName(String name) {
        Optional<ArContentSubTypeEnum> targetEnum = Arrays.stream(ArContentSubTypeEnum.values()).filter(e -> e.getName().equals(name)).findFirst();
        return targetEnum.orElse(null);
    }
}
